package cn.tedu.recruitmentwebsite.employee.controller;

import cn.tedu.recruitmentwebsite.base.pojo.vo.TalentVO;
import cn.tedu.recruitmentwebsite.base.response.JsonResult;
import cn.tedu.recruitmentwebsite.base.response.PageResult;
import cn.tedu.recruitmentwebsite.employee.pojo.dto.PageQueryTalentParam;
import cn.tedu.recruitmentwebsite.employee.service.EmployeeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/employee/")
@Slf4j
public class EmployeeController {
    @Autowired
    private EmployeeService employeeService;
    @GetMapping("/selectCompanies")
    public JsonResult selectCompanies(){
     List<String> companyNames =  employeeService.selectCompanies();
     log.info("查询公司：{}",companyNames);
        return JsonResult.ok(companyNames);
    }
    /**
     * 分页查询牛马
     * @param pageQuery
     * @return
     */
    @GetMapping("getPageQueryTalent")
    public JsonResult getPageQueryTalent(PageQueryTalentParam pageQuery){
        log.info("分页条件查询牛马-入数：{}",pageQuery);
        PageResult pageResults = employeeService.getPageQueryTalent(pageQuery);
        log.info("分页条件查询牛马-出数：{}",pageResults);
        return JsonResult.ok(pageResults);
    }

    @GetMapping("getRecommendTalent/{total}")
    public JsonResult getRecommendTalent(@PathVariable long total){
        log.info("推荐牛马分页查询个数：{}",total);
        List<TalentVO> list = employeeService.getRecommendTalent(total);
        return JsonResult.ok(list);
    }
}
